package com.marvels.product.productmanage.api;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.marvels.common.dto.MarvelsApiResultDTO;
import com.marvels.common.exception.MarvelsBusinessException;
import com.marvels.common.exception.MarvelsErrorCode;
import com.marvels.common.utils.MarvelsLogUtil;
import com.marvels.product.productmanage.dto.FeeRateDTO;
import com.marvels.product.productmanage.service.ParamsAchieveService;
@RequestMapping("product/achieve/api")
@Controller
public class ParamsAchieveController {
	@Autowired
	private ParamsAchieveService paramsAchieveService ;
	@ResponseBody
	@RequestMapping("feeRateAndManagementExpense")
	public MarvelsApiResultDTO feeRateAndManagementExpense(@RequestBody FeeRateDTO feeRateDto) {
		try { 
			Map<String,Object> result = paramsAchieveService.feeRateAndManagementExpense(feeRateDto);
			return MarvelsApiResultDTO.getResult(MarvelsErrorCode.SUCCESS.getValue(), MarvelsErrorCode.SUCCESS.getDesc(),result,null,null);
		} catch (MarvelsBusinessException e) {
			MarvelsLogUtil.getInstance().error(e.getMessage(), e);
			return MarvelsApiResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage(),null,null);
		} catch (Exception e) {
			MarvelsLogUtil.getInstance().error("系统异常", e);
			return MarvelsApiResultDTO.getResult(MarvelsErrorCode.FAIL.getValue(), MarvelsErrorCode.FAIL.getDesc(),e.getMessage(),null,null);
		}
	}
	
}
